CSharpTest.Net
FileVersion Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTreeOptions<TKey,TValue> Class : FileVersion Property

Glossary Item Box

Returns the version this option set is compatable with.

Syntax

Visual Basic (Declaration) 
Public MustOverride ReadOnly Property FileVersion As FileVersion
C# 
public abstract FileVersion FileVersion {get;}

Example

BPlusTree/BPlusTree.Test/SampleCustomTypeTest.cs

C#Copy Code
BPlusTree<KeyInfo, DataValue>.Options options =
    new BPlusTree<KeyInfo, DataValue>.Options(new KeyInfoSerializer(), new DataValueSerializer(), new KeyInfoComparer());
options.CalcBTreeOrder(32, 300);//we can simply just guess close
options.FileName = TempFile.TempPath;
options.CreateFile = CreatePolicy.Always;//obviously this is just for testing
Assert.AreEqual(FileVersion.Version1, options.FileVersion);

Random rand = new Random();
KeyInfo k1 = new KeyInfo(), k2 = new KeyInfo();

using (BPlusTree<KeyInfo, DataValue> tree = new BPlusTree<KeyInfo, DataValue>(options))
{
    byte[] data = new byte[255];

    rand.NextBytes(data);
    tree.Add(k1, new DataValue(k1, data));

    Assert.IsTrue(tree.ContainsKey(k1));
    Assert.IsFalse(tree.ContainsKey(k1.Next()));
    Assert.AreEqual(data, tree[k1].Bytes);

    rand.NextBytes(data);
    tree.Add(k2, new DataValue(k2, data));

    Assert.IsTrue(tree.ContainsKey(k2));
    Assert.IsFalse(tree.ContainsKey(k2.Next()));
    Assert.AreEqual(data, tree[k2].Bytes);
}
options.CreateFile = CreatePolicy.Never;
using (BPlusTree<KeyInfo, DataValue> tree = new BPlusTree<KeyInfo, DataValue>(options))
{
    Assert.IsTrue(tree.ContainsKey(k1));
    Assert.IsTrue(tree.ContainsKey(k2));
}
VB.NETCopy Code
Dim options As New BPlusTree(Of KeyInfo, DataValue).Options(New KeyInfoSerializer(), New DataValueSerializer(), New KeyInfoComparer())
options.CalcBTreeOrder(32, 300)
'we can simply just guess close
options.FileName = TempFile.TempPath
options.CreateFile = CreatePolicy.Always
'obviously this is just for testing
Assert.AreEqual(FileVersion.Version1, options.FileVersion)

Dim rand As New Random()
Dim k1 As New KeyInfo(), k2 As New KeyInfo()

Using tree As New BPlusTree(Of KeyInfo, DataValue)(options)
    Dim data As Byte() = New Byte(255) {}

    rand.NextBytes(data)
    tree.Add(k1, New DataValue(k1, data))

    Assert.IsTrue(tree.ContainsKey(k1))
    Assert.IsFalse(tree.ContainsKey(k1.[Next]()))
    Assert.AreEqual(data, tree(k1).Bytes)

    rand.NextBytes(data)
    tree.Add(k2, New DataValue(k2, data))

    Assert.IsTrue(tree.ContainsKey(k2))
    Assert.IsFalse(tree.ContainsKey(k2.[Next]()))
    Assert.AreEqual(data, tree(k2).Bytes)
End Using
options.CreateFile = CreatePolicy.Never
Using tree As New BPlusTree(Of KeyInfo, DataValue)(options)
    Assert.IsTrue(tree.ContainsKey(k1))
    Assert.IsTrue(tree.ContainsKey(k2))
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys